package com.ctshk.rpc.order.tour.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ctshk.rpc.order.tour.base.CustomBaseMapper;
import com.ctshk.rpc.order.tour.dto.SeriesOrderTouristVisaDetailDTO;
import com.ctshk.rpc.order.tour.dto.SeriesOrderTouristVisaListDTO;
import com.ctshk.rpc.order.tour.entity.SeriesOrderTouristVisa;
import com.ctshk.rpc.order.tour.req.SeriesOrderTouristVisaDetailReq;
import com.ctshk.rpc.order.tour.req.SeriesOrderTouristVisaListReq;

import java.math.BigDecimal;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

/**
 * <p>
 * 系列团游客签证记录 Mapper 接口
 * </p>
 *
 * @author 谭响
 * @since 2021-01-27
 */
public interface SeriesOrderTouristVisaMapper extends CustomBaseMapper<SeriesOrderTouristVisa> {

    /**
     * 列表
     */
    @SelectProvider(type = SeriesOrderTouristVisaProvider.class, method = "selectListBySelective")
    IPage<SeriesOrderTouristVisaListDTO> selectListBySelective(IPage<SeriesOrderTouristVisaListReq> pageParam, @Param("req") SeriesOrderTouristVisaListReq req);

    /**
     * 列表
     */
    @SelectProvider(type = SeriesOrderTouristVisaProvider.class, method = "selectDetailBySelective")
    SeriesOrderTouristVisaDetailDTO selectDetailBySelective(@Param("req") SeriesOrderTouristVisaDetailReq req);
    
    /**
     * 根据旅客ID查询旅客的签证费用
     * @param touristId
     * @return
     */
    @Select("select ifnull(sum(t.visa_amount), 0) from t_series_order_tourist_visa t where  t.id = #{touristId}")
    BigDecimal findAllVisaAmountByTouristId(Long touristId);
}
